/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.maixiami;

import com.sleepycat.persist.model.Entity;
import com.sleepycat.persist.model.PrimaryKey;
import com.sleepycat.persist.model.Relationship;
import com.sleepycat.persist.model.SecondaryKey;
import com.taobao.api.domain.TaobaokeShop;
import com.taobao.api.domain.User;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 *
 * @author 叶勤勇
 */
@Entity
public class TaobaoUserEntity implements Serializable {
    @PrimaryKey
    private Long user_id;
    @SecondaryKey(relate=Relationship.ONE_TO_ONE)
    private String nick;
    
    @SecondaryKey(relate=Relationship.MANY_TO_ONE)    
    private String state;
    private String city;
    @SecondaryKey(relate=Relationship.MANY_TO_ONE)
    private String statecity;
    
    private Long sellerCredit_goodNum;
    private Long sellerCredit_level;
    private Long sellerCredit_score;
    private Long sellerCredit_totalNum;
    
    private String sex;
    private String type;
    
    @SecondaryKey(relate=Relationship.MANY_TO_ONE)
    private String shopTitle;
    private String clickUrl;
    private String commissionRate;
    private String totalAuction;
    private Long auctionCount;
    @SecondaryKey(relate=Relationship.MANY_TO_MANY)
    private Set<Long> cids = new HashSet<Long>();
    
    public TaobaoUserEntity() {}
    
    public TaobaoUserEntity(User user, TaobaokeShop shop) {
        this.user_id = user.getUserId();
        this.nick = user.getNick();
        this.state = user.getLocation().getState();
        this.city = user.getLocation().getCity();
        this.statecity = this.state + this.city;
        this.sellerCredit_goodNum = user.getSellerCredit().getGoodNum();
        this.sellerCredit_level = user.getSellerCredit().getLevel();
        this.sellerCredit_score = user.getSellerCredit().getScore();
        this.sellerCredit_totalNum = user.getSellerCredit().getTotalNum();
        this.sex = user.getSex();
        this.type = user.getType();
        
        this.shopTitle = shop.getShopTitle();
        this.clickUrl = shop.getClickUrl();
        this.commissionRate = shop.getCommissionRate();
        this.totalAuction = shop.getTotalAuction();
        this.auctionCount = shop.getAuctionCount();
        
    }

    public Set<Long> getCids() {
        return cids;
    }

    public void setCids(Set<Long> cids) {
        this.cids = cids;
    }
    
    public Long getAuctionCount() {
        return auctionCount;
    }

    public void setAuctionCount(Long auctionCount) {
        this.auctionCount = auctionCount;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getClickUrl() {
        return clickUrl;
    }

    public void setClickUrl(String clickUrl) {
        this.clickUrl = clickUrl;
    }

    public String getCommissionRate() {
        return commissionRate;
    }

    public void setCommissionRate(String commissionRate) {
        this.commissionRate = commissionRate;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    public Long getSellerCredit_goodNum() {
        return sellerCredit_goodNum;
    }

    public void setSellerCredit_goodNum(Long sellerCredit_goodNum) {
        this.sellerCredit_goodNum = sellerCredit_goodNum;
    }

    public Long getSellerCredit_level() {
        return sellerCredit_level;
    }

    public void setSellerCredit_level(Long sellerCredit_level) {
        this.sellerCredit_level = sellerCredit_level;
    }

    public Long getSellerCredit_score() {
        return sellerCredit_score;
    }

    public void setSellerCredit_score(Long sellerCredit_score) {
        this.sellerCredit_score = sellerCredit_score;
    }

    public Long getSellerCredit_totalNum() {
        return sellerCredit_totalNum;
    }

    public void setSellerCredit_totalNum(Long sellerCredit_totalNum) {
        this.sellerCredit_totalNum = sellerCredit_totalNum;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getShopTitle() {
        return shopTitle;
    }

    public void setShopTitle(String shopTitle) {
        this.shopTitle = shopTitle;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getStatecity() {
        return statecity;
    }

    public void setStatecity(String statecity) {
        this.statecity = statecity;
    }

    public String getTotalAuction() {
        return totalAuction;
    }

    public void setTotalAuction(String totalAuction) {
        this.totalAuction = totalAuction;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Long getUser_id() {
        return user_id;
    }

    public void setUser_id(Long user_id) {
        this.user_id = user_id;
    }
    
    
}
